package view;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;

public class Menubar extends JMenuBar implements ActionListener{

	private static final long serialVersionUID = 1L;
	
	private JMenu datei;
		private JMenuItem newGame;
		private JMenuItem pause;
		private JMenuItem highscore;
		private JMenuItem close;
		
	private JMenu help;
		private JMenuItem usage;
		private JMenuItem about;
		
	
	public Menubar(){
		this.datei = new JMenu("Datei");
			this.newGame = new JMenuItem("Neues Spiel");
			this.newGame.addActionListener(this);
				this.datei.add(this.newGame);
			this.pause = new JMenuItem("Pause");
			this.pause.addActionListener(this);
				this.datei.add(this.pause);
			this.highscore = new JMenuItem("Highscore");
			this.highscore.addActionListener(this);
				this.datei.add(this.highscore);
			this.close = new JMenuItem("Beenden");
			this.close.addActionListener(this);
				this.datei.add(this.close);
				
		this.help = new JMenu("Hilfe");
			this.usage = new JMenuItem("Anleitung");
			this.usage.addActionListener(this);
				this.help.add(this.usage);
			this.about = new JMenuItem("About");
			this.about.addActionListener(this);
				this.help.add(this.about);		
				
		this.add(this.datei);
		this.add(this.help);
		
	}


	@Override
	public void actionPerformed(ActionEvent arg0) {
		
		if(arg0.getSource() == this.highscore)
			new Highscore((Mario) this.getTopLevelAncestor());
		
	}

	

}
